import * as React from "react";
import TitleBar from "@/components/common/title-bar";
import {Inject} from "@/core/base/inject";
import {WindowService} from "@/core/services/window-service";
import {MongoService} from "@/core/services/mongo-service";
import {CommonNode} from "@/utils/tree/TreeNode";
import {DemoService} from "@/core/services/DemoService";
// import Demo from "@/components/common/demo";
import MainHeader from "@/components/common/main-header";
import MainContainer from "@/components/common/main-container";
import MainLeft from "@/components/common/main-left";
import MainCenter from "@/components/common/main-center";
import MainRight from "@/components/common/main-right";
import MainFooter from "@/components/common/main-footer";


export class IData {
    value:number
}

export default class App extends React.Component<any, IData> {
    @Inject("WindowService") windowService: WindowService;
    @Inject("MongoService") mongodbService: MongoService;
    @Inject("DemoService") demoService: DemoService;

    constructor(props:any) {
        super(props);
        this.state = {
            value:0
        };
    }
    update() {
        let i_node = new CommonNode();
        console.log(i_node);

        let com = this.componse(this.log, this.upper);

        console.log(com("cool"))
    }

    componse(...funcs: any[]) {
        return funcs.reduce((a: any, b: any) => (...args: any[]) => a(b(...args)))
    }

    upper(html: string) {
        return html.toUpperCase()
    }

    log(text: string) {
        return `html ${text}`
    }

    render() {
        return <div className="main-window">
            <TitleBar/>
            <MainHeader/>
            <MainContainer>
                <MainLeft/>
                <MainCenter/>
                <MainRight/>
            </MainContainer>
            <MainFooter/>

        </div>
    }
}
